package com.why.blog.config;

import com.why.blog.Interceptor.loginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @program: blog
 * @description:
 * @author: @why
 * @create: 2021-01-17 11:35
 **/
@Configuration
public class webConfig implements WebMvcConfigurer {
    @Autowired
    private loginInterceptor login;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(login).addPathPatterns("/admin/**").excludePathPatterns("/admin/login");
//                .excludePathPatterns("/**");
    }
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {

    }
}
